package cn.tedu.csmall.stock.webapi.quartz.config;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class RabbitStockConfig {

    public static final String STOCK_TB_EX="stock_tb_ex";
    public static final String STOCK_TB_ROUT="stock_tb_rout";
    public static final String STOCK_TB_QUEUE="stock_tb_queue";

    @Bean
    public DirectExchange tbDirectExchange(){
        return new DirectExchange(STOCK_TB_EX);
    }

    @Bean
    public Queue tbQueue(){
        return new Queue(STOCK_TB_QUEUE);
    }

    @Bean
    public Binding tbBinding(){
        return BindingBuilder.bind(tbQueue()).to(tbDirectExchange()).with(STOCK_TB_ROUT);
    }


}
